# For more information about using CMake with Android Studio, read the
# documentation: https://d.android.com/studio/projects/add-native-code.html

# Sets the minimum version of CMake required to build the native library.

cmake_minimum_required(VERSION 3.4.1)

#配置加载头文件
include_directories(./openssl/include)
#将源码添加到NATIVE_SRC
aux_source_directory(./src/main/cpp NATIVE_SRC)

add_library(
        # Sets the name of the library.
        safe_keyboard_lib
        # Sets the library as a shared library.
        SHARED
        # Provides a relative path to your source file(s).
        src/main/cpp/safe_keyboard_lib.cpp
)

#动态方式加载
add_library(openssl SHARED IMPORTED)
add_library(ssl SHARED IMPORTED)
#引入第三方.so库
set_target_properties(openssl PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/openssl/lib/${ANDROID_ABI}/libcrypto.so)
set_target_properties(ssl PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_SOURCE_DIR}/openssl/lib/${ANDROID_ABI}/libssl.so)

# Specifies libraries CMake should link to your target library. You
# can link multiple libraries, such as libraries you define in this
# build script, prebuilt third-party libraries, or system libraries.

find_library( # Sets the name of the path variable.
        log-lib

        # Specifies the name of the NDK library that
        # you want CMake to locate.
        log)

target_link_libraries(
        # Specifies the target library.
        safe_keyboard_lib
        openssl
        ssl
        android
        ${log-lib})